﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GiveMeMenu.Service.MessageContracts;
using GiveMeMenu.Service.DataLayer;

namespace GiveMeMenu.Service
{
    public class GMMService : IGMMService
    {
        private IGMMDataAccessLayer m_DataAccessLayer;

        public GMMService()
        {
            m_DataAccessLayer = new GMMDataAccessLayer();
        }

        /// <summary>
        /// Gets all dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public ResponseGetAllDishs GetAllDishes(RequestGetAllDishs request)
        {
            var response = new ResponseGetAllDishs()
            {
                Result = m_DataAccessLayer.GetAllDishs()
            };
            return response;
        }


        /// <summary>
        /// Removes the order.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public ResponseRemoveOrder RemoveOrder(RequestRemoveOrder request)
        {
            var response = new ResponseRemoveOrder()
            {
                Result = m_DataAccessLayer.RemoveOrder(request.OId)
            };
            return response;
        }

        /// <summary>
        /// Removes the order information.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public ResponseRemoveOrderInformation RemoveOrderInformation(RequestRemoveOrderInformation request)
        {
            var response = new ResponseRemoveOrderInformation()
            {
                Result = m_DataAccessLayer.RemoveOrderInformation(request.OId)
            };
            return response;
        }

        /// <summary>
        /// Gets the dish today.
        /// </summary>
        /// <param name="response"></param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public ResponseGetDishToday GetDishToday(RequestGetDishToday request)
        {
            var response = new ResponseGetDishToday()
            {
                Result = m_DataAccessLayer.GetDishToday()
            };
            return response;
        }


        /// <summary>
        /// Adds the dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseAddDish AddDish(RequestAddDish request)
        {
            var response = new ResponseAddDish();
            var result = m_DataAccessLayer.AddDish(request.Dish);
            response.Result = result;
            return response;
        }

        /// <summary>
        /// Adds the order.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseAddOrder AddOrder(RequestAddOrder request)
        {
            var response = new ResponseAddOrder()
           {
               Result = m_DataAccessLayer.AddOrder(request.Order)
           };
            return response;
        }

        /// <summary>
        /// Adds the order information.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        ResponseAddOrderInformation IGMMService.AddOrderInformation(RequestAddOrderInformation request)
        {
            var response = new ResponseAddOrderInformation()
            {
                Result = m_DataAccessLayer.AddOrderInformation(request.OrderInformation)
            };
            return response;
        }


        /// <summary>
        /// Addlus the table.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseAddluTable AddluTable(RequestAddluTable request)
        {
            var response = new ResponseAddluTable()
            {
                Result = m_DataAccessLayer.AddluTable(request.LuTable)
            };
            return response;
        }

        /// <summary>
        /// Addlus the type dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseAddluTypeDish AddluTypeDish(RequestAddluTypeDish request)
        {
            var response = new ResponseAddluTypeDish()
            {
                Result = m_DataAccessLayer.AddluTypeDish(request.LuTypeDish)
            };
            return response;
        }

        /// <summary>
        /// Getlus the tables.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseGetluTables GetluTables(RequestGetluTables request)
        {
            var response = new ResponseGetluTables()
            {
                Result = m_DataAccessLayer.GetluTables()
            };
            return response;
        }

        /// <summary>
        /// Getlus the type dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseGetluTypeDish GetluTypeDish(RequestGetluTypeDish request)
        {
            var response = new ResponseGetluTypeDish()
            {
                Result = m_DataAccessLayer.GetluTypeDish()
            };
            return response;
        }

        /// <summary>
        /// Gets the order information by order id.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseGetOrderInformationByOrderId GetOrderInformationByOrderId(RequestGetOrderInformationByOrderId request)
        {
            var response = new ResponseGetOrderInformationByOrderId()
            {
                Result = m_DataAccessLayer.GetOrderInformationByOrderId(request.OrderId)
            };
            return response;
        }

        /// <summary>
        /// Removes the dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseRemoveDish RemoveDish(RequestRemoveDish request)
        {
            var response = new ResponseRemoveDish()
            {
                Result = m_DataAccessLayer.RemoveDish(request.OId)
            };
            return response;
        }

        /// <summary>
        /// Removelus the table.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseRemoveluTable RemoveluTable(RequestRemoveluTable request)
        {
            var response = new ResponseRemoveluTable()
            {
                Result = m_DataAccessLayer.RemoveluTable(request.OId)
            };
            return response;
        }

        /// <summary>
        /// Removelus the type dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseRemoveluTypeDish RemoveluTypeDish(RequestRemoveluTypeDish request)
        {
            var response = new ResponseRemoveluTypeDish()
            {
                Result = m_DataAccessLayer.RemoveluTypeDish(request.OId)
            };
            return response;
        }

        /// <summary>
        /// Updates the dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseUpdateDish UpdateDish(RequestUpdateDish request)
        {
            var response = new ResponseUpdateDish()
            {
                Result = m_DataAccessLayer.UpdateDish(request.Dish)
            };
            return response;
        }

        /// <summary>
        /// Updatelus the table.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseUpdateluTable UpdateluTable(RequestUpdateluTable request)
        {
            var response = new ResponseUpdateluTable()
            {
                Result = m_DataAccessLayer.UpdateluTable(request.LuTable)
            };
            return response;
        }

        /// <summary>
        /// Lus the type dish.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseUpdateluTypeDish UpdateluTypeDish(RequestUpdateluTypeDish request)
        {
            var response = new ResponseUpdateluTypeDish()
            {
                Result = m_DataAccessLayer.UpdateluTypeDish(request.LuTypeDish)
            };
            return response;
        }

        /// <summary>
        /// Updates the order.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public ResponseUpdateOrder UpdateOrder(RequestUpdateOrder request)
        {
            var response = new ResponseUpdateOrder()
            {
                Result = m_DataAccessLayer.UpdateOrder(request.Order)
            };
            return response;
        }
    }
}
